{% extends 'base.html' %}


{% block content %}

	<div class="main_wrap clearfix">
		<div class="r_wrap fr clearfix">
                <p>搜索关键字 {{ query }}</p>



			<ul class="goods_type_list clearfix">

                {%  for item in page %}
                <li>
					<a href="/goods/detail/{{ item.object.id }}/"><img src="/static/{{ item.object.image }}"></a>
					<h4><a href="/{{ item.object.id }}/">{{ item.object.name }}</a></h4>
					<div class="operate">
						<span class="prize">￥{{ item.object.price }}</span>
						<span class="unit">{{ item.object.unit }}</span>
						<a href="/cart/add{{ item.object.id }}_1/" class="add_goods" title="加入购物车"></a>
{#						<a href="javasript:;/" class="add_goods" title="加入购物车"></a>#}
					</div>
				</li>
                {% empty %}
                {% endfor %}
			</ul>

			<div class="pagenation">
{#                判断是否是第一页#}
                {% if page.has_previous %}
                    <a href="?q={{ query }}&page={{ page.previous_page_number }}">上一页</a>
                {% endif %}

                {% for pindex in paginator.page_range %}
                    {% if pindex == page.number %}
                        <a href="?q={{ query }}&page={{ pindex }}" class="active">{{ pindex }}</a>
                    {% else %}
                        <a href="?q={{ query }}&page={{ pindex }}">{{ pindex }}</a>
                    {% endif %}
                {% endfor %}

{#                是否为第二页#}
                {% if page.has_next %}
				<a href="?q={{ query }}&page={{ page.next_page_number }}">下一页></a>
                {% endif %}
			</div>
		</div>
	</div>

{% endblock content %}